home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / CardServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  30.9 KB  |  912 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CardServices.h
  3.  
  4.      Contains:    The client interface to Card and Socket Services.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc. All rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CARDSERVICES__
  18. #define __CARDSERVICES__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __PCCARDTUPLES__
  24. #include <PCCardTuples.h>
  25. #endif
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. /*    miscellaneous*/
  53.  
  54.  
  55. enum {
  56.     CS_MAX_SOCKETS                = 32                            /* a long is used as a socket bitmap*/
  57. };
  58.  
  59.  
  60. /* Will move to <Traps.h>*/
  61.  
  62. enum {
  63.     _PCCardDispatch                = 0xAAF0                        /* Card Services entry trap*/
  64. };
  65.  
  66. /* Will move to <Errors.h>*/
  67.  
  68. /*    result codes*/
  69.  
  70.  
  71. enum {
  72.     kCSBadAdapterErr            = -9050,                        /* invalid adapter number*/
  73.     kCSBadAttributeErr            = -9051,                        /* specified attributes field value is invalid*/
  74.     kCSBadBaseErr                = -9052,                        /* specified base system memory address is invalid*/
  75.     kCSBadEDCErr                = -9053,                        /* specified EDC generator specified is invalid*/
  76.     kCSBadIRQErr                = -9054,                        /* specified IRQ level is invalid*/
  77.     kCSBadOffsetErr                = -9055,                        /* specified PC card memory array offset is invalid*/
  78.     kCSBadPageErr                = -9056,                        /* specified page is invalid*/
  79.     kCSBadSizeErr                = -9057,                        /* specified size is invalid*/
  80.     kCSBadSocketErr                = -9058,                        /* specified logical or physical socket number is invalid*/
  81.     kCSBadTypeErr                = -9059,                        /* specified window or interface type is invalid*/
  82.     kCSBadVccErr                = -9060,                        /* specified Vcc power level index is invalid*/
  83.     kCSBadVppErr                = -9061,                        /* specified Vpp1 or Vpp2 power level index is invalid*/
  84.     kCSBadWindowErr                = -9062,                        /* specified window is invalid*/
  85.     kCSBadArgLengthErr            = -9063,                        /* ArgLength argument is invalid*/
  86.     kCSBadArgsErr                = -9064,                        /* values in argument packet are invalid*/
  87.     kCSBadHandleErr                = -9065,                        /* clientHandle is invalid*/
  88.     kCSBadCISErr                = -9066,                        /* CIS on card is invalid*/
  89.     kCSBadSpeedErr                = -9067,                        /* specified speed is unavailable*/
  90.     kCSReadFailureErr            = -9068,                        /* unable to complete read request*/
  91.     kCSWriteFailureErr            = -9069,                        /* unable to complete write request*/
  92.     kCSGeneralFailureErr        = -9070,                        /* an undefined error has occurred*/
  93.     kCSNoCardErr                = -9071,                        /* no PC card in the socket*/
  94.     kCSUnsupportedFunctionErr    = -9072,                        /* function is not supported by this implementation*/
  95.     kCSUnsupportedModeErr        = -9073,                        /* mode is not supported*/
  96.     kCSBusyErr                    = -9074,                        /* unable to process request at this time - try later*/
  97.     kCSWriteProtectedErr        = -9075,                        /* media is write-protected*/
  98.     kCSConfigurationLockedErr    = -9076,                        /* a configuration has already been locked*/
  99.     kCSInUseErr                    = -9077,                        /* requested resource is being used by a client*/
  100.     kCSNoMoreItemsErr            = -9078,                        /* there are no more of the requested item*/
  101.     kCSOutOfResourceErr            = -9079                            /* Card Services has exhausted the resource*/
  102. };
  103.  
  104.  
  105.  
  106. /*    messages sent to client's event handler*/
  107.  
  108.  
  109. enum {
  110.     kCSNullMessage                = 0x00,                            /* no messages pending (not sent to clients)*/
  111.     kCSCardInsertionMessage        = 0x01,                            /* card has been inserted into the socket*/
  112.     kCSCardRemovalMessage        = 0x02,                            /* card has been removed from the socket*/
  113.     kCSCardLockMessage            = 0x03,                            /* card is locked into the socket with a mechanical latch*/
  114.     kCSCardUnlockMessage        = 0x04,                            /* card is no longer locked into the socket*/
  115.     kCSCardReadyMessage            = 0x05,                            /* card is ready to be accessed*/
  116.     kCSCardResetMessage            = 0x06,                            /* physical reset has completed*/
  117.     kCSInsertionRequestMessage    = 0x07,                            /* request to insert a card using insertion motor*/
  118.     kCSInsertionCompleteMessage    = 0x08,                            /* insertion motor has finished inserting a card*/
  119.     kCSEjectionRequestMessage    = 0x09,                            /* user or other client is requesting a card ejection*/
  120.     kCSEjectionFailedMessage    = 0x0A,                            /* eject failure due to electrical/mechanical problems*/
  121.     kCSPMResumeMessage            = 0x0B,                            /* power management resume (TBD)*/
  122.     kCSPMSuspendMessage            = 0x0C,                            /* power management suspend (TBD)*/
  123.     kCSResetPhysicalMessage        = 0x0D,                            /* physical reset is about to occur on this card*/
  124.     kCSResetRequestMessage        = 0x0E,                            /* physical reset has been requested by a client*/
  125.     kCSResetCompleteMessage        = 0x0F,                            /* ResetCard() background reset has completed*/
  126.     kCSBatteryDeadMessage        = 0x10,                            /* battery is no longer useable, data will be lost*/
  127.     kCSBatteryLowMessage        = 0x11,                            /* battery is weak and should be replaced*/
  128.     kCSWriteProtectMessage        = 0x12,                            /* card is now write protected*/
  129.     kCSWriteEnabledMessage        = 0x13,                            /* card is now write enabled*/
  130.     kCSClientInfoMessage        = 0x14,                            /* client is to return client information*/
  131.     kCSSSUpdatedMessage            = 0x15,                            /* AddSocketServices/ReplaceSocket services has changed SS support*/
  132.     kCSFunctionInterruptMessage    = 0x16,                            /* card function interrupt*/
  133.     kCSAccessErrorMessage        = 0x17,                            /* client bus errored on access to socket*/
  134.     kCSCardUnconfiguredMessage    = 0x18,                            /* a CARD_READY was delivered to all clients and no client */
  135.                                                                 /*    requested a configuration for the socket*/
  136.     kCSStatusChangedMessage        = 0x19                            /* status change for cards in I/O mode*/
  137. };
  138.  
  139. /*
  140.     The following is a mapping of the PCMCIA name space to the Macintosh name space.
  141.     These two enum lists will be removed and given to developers as a separate file.
  142. */
  143.  
  144. enum {
  145.     SUCCESS                        = noErr,
  146.     BAD_ADAPTER                    = kCSBadAdapterErr,
  147.     BAD_ATTRIBUTE                = kCSBadAttributeErr,
  148.     BAD_BASE                    = kCSBadBaseErr,
  149.     BAD_EDC                        = kCSBadEDCErr,
  150.     BAD_IRQ                        = kCSBadIRQErr,
  151.     BAD_OFFSET                    = kCSBadOffsetErr,
  152.     BAD_PAGE                    = kCSBadPageErr,
  153.     BAD_SIZE                    = kCSBadSizeErr,
  154.     BAD_SOCKET                    = kCSBadSocketErr,
  155.     BAD_TYPE                    = kCSBadTypeErr,
  156.     BAD_VCC                        = kCSBadVccErr,
  157.     BAD_VPP                        = kCSBadVppErr,
  158.     BAD_WINDOW                    = kCSBadWindowErr,
  159.     BAD_ARG_LENGTH                = kCSBadArgLengthErr,
  160.     BAD_ARGS                    = kCSBadArgsErr,
  161.     BAD_HANDLE                    = kCSBadHandleErr,
  162.     BAD_CIS                        = kCSBadCISErr,
  163.     BAD_SPEED                    = kCSBadSpeedErr,
  164.     READ_FAILURE                = kCSReadFailureErr,
  165.     WRITE_FAILURE                = kCSWriteFailureErr,
  166.     GENERAL_FAILURE                = kCSGeneralFailureErr,
  167.     NO_CARD                        = kCSNoCardErr,
  168.     UNSUPPORTED_FUNCTION        = kCSUnsupportedFunctionErr,
  169.     UNSUPPORTED_MODE            = kCSUnsupportedModeErr,
  170.     BUSY                        = kCSBusyErr,
  171.     WRITE_PROTECTED                = kCSWriteProtectedErr,
  172.     CONFIGURATION_LOCKED        = kCSConfigurationLockedErr,
  173.     IN_USE                        = kCSInUseErr,
  174.     NO_MORE_ITEMS                = kCSNoMoreItemsErr,
  175.     OUT_OF_RESOURCE                = kCSOutOfResourceErr
  176. };
  177.  
  178.  
  179. /*    messages sent to client's event handler*/
  180.  
  181.  
  182. enum {
  183.     NULL_MESSAGE                = kCSNullMessage,
  184.     CARD_INSERTION                = kCSCardInsertionMessage,
  185.     CARD_REMOVAL                = kCSCardRemovalMessage,
  186.     CARD_LOCK                    = kCSCardLockMessage,
  187.     CARD_UNLOCK                    = kCSCardUnlockMessage,
  188.     CARD_READY                    = kCSCardReadyMessage,
  189.     CARD_RESET                    = kCSCardResetMessage,
  190.     INSERTION_REQUEST            = kCSInsertionRequestMessage,
  191.     INSERTION_COMPLETE            = kCSInsertionCompleteMessage,
  192.     EJECTION_REQUEST            = kCSEjectionRequestMessage,
  193.     EJECTION_FAILED                = kCSEjectionFailedMessage,
  194.     PM_RESUME                    = kCSPMResumeMessage,
  195.     PM_SUSPEND                    = kCSPMSuspendMessage,
  196.     RESET_PHYSICAL                = kCSResetPhysicalMessage,
  197.     RESET_REQUEST                = kCSResetRequestMessage,
  198.     RESET_COMPLETE                = kCSResetCompleteMessage,
  199.     BATTERY_DEAD                = kCSBatteryDeadMessage,
  200.     BATTERY_LOW                    = kCSBatteryLowMessage,
  201.     WRITE_PROTECT                = kCSWriteProtectMessage,
  202.     WRITE_ENABLED                = kCSWriteEnabledMessage,
  203.     CLIENT_INFO                    = kCSClientInfoMessage,
  204.     SS_UPDATED                    = kCSSSUpdatedMessage,
  205.     FUNCTION_INTERRUPT            = kCSFunctionInterruptMessage,
  206.     ACCESS_ERROR                = kCSAccessErrorMessage,
  207.     CARD_UNCONFIGURED            = kCSCardUnconfiguredMessage,
  208.     STATUS_CHANGED                = kCSStatusChangedMessage
  209. };
  210.  
  211.  
  212. /*----------------        CSAccessConfigurationRegister    ----------------*/
  213.  
  214.  
  215. struct AccessConfigurationRegisterPB {
  216.     UInt16                             socket;                        /*  -> global socket number*/
  217.     UInt8                             action;                        /*  -> read/write*/
  218.     UInt8                             offset;                        /*  -> offset from config register base*/
  219.     UInt8                             value;                        /* <-> value to read/write*/
  220.     UInt8                             padding[1];                    /* */
  221. };
  222. typedef struct AccessConfigurationRegisterPB AccessConfigurationRegisterPB;
  223. /*    ‘action’ field values*/
  224.  
  225.  
  226. enum {
  227.     kCSReadConfigRegister        = 0x00,
  228.     kCSWriteConfigRegister        = 0x01
  229. };
  230.  
  231.  
  232. /*----------------        CSGetCardServicesInfo            ----------------*/
  233.  
  234.  
  235. struct GetCardServicesInfoPB {
  236.     UInt8                             signature[2];                /* <-  two ascii chars 'CS'*/
  237.     UInt16                             count;                        /* <-  total number of sockets installed*/
  238.     UInt16                             revision;                    /* <-  BCD*/
  239.     UInt16                             csLevel;                    /* <-  BCD*/
  240.     UInt16                             reserved;                    /*  -> zero*/
  241.     UInt16                             vStrLen;                    /* <-> in: client's buffer size, out: vendor string length*/
  242.     UInt8 *                            vendorString;                /* <-> in: pointer to buffer to hold CS vendor string (zero-terminated)*/
  243.                                                                 /*      out: CS vendor string copied to buffer*/
  244. };
  245. typedef struct GetCardServicesInfoPB    GetCardServicesInfoPB;
  246. /*----------------        CSGetClientInfo                    ----------------*/
  247.  
  248.  
  249. /* upper byte of attributes is kCSClientInfoSubfunction*/
  250.  
  251. struct ClientInfoParam {
  252.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  253.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  254.     UInt16                             revision;                    /* <-  BCD value of client's revision*/
  255.     UInt16                             csLevel;                    /* <-  BCD value of CS release*/
  256.     UInt16                             revDate;                    /* <-  revision date: y[15-9], m[8-5], d[4-0]*/
  257.     SInt16                             nameLen;                    /* <-> in: max length of client name string, out: actual length*/
  258.     SInt16                             vStringLen;                    /* <-> in: max length of vendor string, out: actual length*/
  259.     UInt8 *                            nameString;                    /* <-  pointer to client name string (zero-terminated)*/
  260.     UInt8 *                            vendorString;                /* <-  pointer to vendor string (zero-terminated)*/
  261. };
  262. typedef struct ClientInfoParam            ClientInfoParam;
  263. /*
  264.    upper byte of attributes is kCSCardNameSubfunction,
  265.                                  kCSCardTypeSubfunction,
  266.                                  kCSHelpStringSubfunction
  267. */
  268.  
  269. struct AlternateTextStringParam {
  270.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  271.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  272.     UInt16                             socket;                        /*  -> logical socket number*/
  273.     UInt16                             reserved;                    /*  -> zero*/
  274.     SInt16                             length;                        /* <-> in: max length of string, out: actual length*/
  275.     UInt8 *                            text;                        /* <-  pointer to string (zero-terminated)*/
  276. };
  277. typedef struct AlternateTextStringParam    AlternateTextStringParam;
  278. /* upper byte of attributes is kCSCardIconSubfunction*/
  279.  
  280. struct AlternateCardIconParam {
  281.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  282.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  283.     UInt16                             socket;                        /*  -> logical socket number*/
  284.     Handle                             iconSuite;                    /* <-  handle to icon suite containing all icons*/
  285. };
  286. typedef struct AlternateCardIconParam    AlternateCardIconParam;
  287. /* upper byte of attributes is kCSActionProcSubfunction*/
  288.  
  289. struct CustomActionProcParam {
  290.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  291.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  292.     UInt16                             socket;                        /*  -> logical socket number*/
  293. };
  294. typedef struct CustomActionProcParam    CustomActionProcParam;
  295.  
  296. struct GetClientInfoPB {
  297.     union {
  298.         ClientInfoParam                 clientInfo;
  299.         AlternateTextStringParam         alternateTextString;
  300.         AlternateCardIconParam             alternateIcon;
  301.         CustomActionProcParam             customActionProc;
  302.     }                                 u;
  303. };
  304. typedef struct GetClientInfoPB            GetClientInfoPB;
  305. /*    ‘attributes’ field values*/
  306.  
  307. enum {
  308.     kCSMemoryClient                = 0x0001,
  309.     kCSIOClient                    = 0x0004,
  310.     kCSClientTypeMask            = 0x0007,
  311.     kCSShareableCardInsertEvents = 0x0008,
  312.     kCSExclusiveCardInsertEvents = 0x0010,
  313.     kCSInfoSubfunctionMask        = 0xFF00,
  314.     kCSClientInfoSubfunction    = 0x0000,
  315.     kCSCardNameSubfunction        = 0x8000,
  316.     kCSCardTypeSubfunction        = 0x8100,
  317.     kCSHelpStringSubfunction    = 0x8200,
  318.     kCSCardIconSubfunction        = 0x8300,
  319.     kCSActionProcSubfunction    = 0x8400
  320. };
  321.  
  322.  
  323. /*
  324.   ----------------        CSGetConfigurationInfo            ----------------
  325.   ----------------        CSModifyConfiguration            ----------------
  326.   ----------------        CSRequestConfiguration            ----------------
  327. */
  328.  
  329.  
  330. struct GetModRequestConfigInfoPB {
  331.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  332.     UInt16                             socket;                        /*  -> logical socket number*/
  333.     UInt16                             attributes;                    /* <-> bitmap of configuration attributes*/
  334.     UInt8                             vcc;                        /* <-> Vcc setting*/
  335.     UInt8                             vpp1;                        /* <-> Vpp1 setting*/
  336.     UInt8                             vpp2;                        /* <-> Vpp2 setting*/
  337.     UInt8                             intType;                    /* <-> interface type (memory or memory+I/O)*/
  338.     UInt32                             configBase;                    /* <-> card base address of configuration registers*/
  339.     UInt8                             status;                        /* <-> card status register setting, if present*/
  340.     UInt8                             pin;                        /* <-> card pin register setting, if present*/
  341.     UInt8                             copy;                        /* <-> card socket/copy register setting, if present*/
  342.     UInt8                             configIndex;                /* <-> card option register setting, if present*/
  343.     UInt8                             present;                    /* <-> bitmap of which configuration registers are present*/
  344.     UInt8                             firstDevType;                /* <-  from DeviceID tuple*/
  345.     UInt8                             funcCode;                    /* <-  from FuncID tuple*/
  346.     UInt8                             sysInitMask;                /* <-  from FuncID tuple*/
  347.     UInt16                             manufCode;                    /* <-  from ManufacturerID tuple*/
  348.     UInt16                             manufInfo;                    /* <-  from ManufacturerID tuple*/
  349.     UInt8                             cardValues;                    /* <-  valid card register values*/
  350.     UInt8                             padding[1];                    /* */
  351. };
  352. typedef struct GetModRequestConfigInfoPB GetModRequestConfigInfoPB;
  353. /*    ‘attributes’ field values*/
  354.  
  355. enum {
  356.     kCSExclusivelyUsed            = 0x0001,
  357.     kCSEnableIREQs                = 0x0002,
  358.     kCSVccChangeValid            = 0x0004,
  359.     kCSVpp1ChangeValid            = 0x0008,
  360.     kCSVpp2ChangeValid            = 0x0010,
  361.     kCSValidClient                = 0x0020,
  362.     kCSSleepPower                = 0x0040,                        /* request that power be applied to socket during Sleep*/
  363.     kCSLockSocket                = 0x0080,
  364.     kCSTurnOnInUse                = 0x0100
  365. };
  366.  
  367. /*    ‘intType’ field values*/
  368.  
  369.  
  370. enum {
  371.     kCSMemoryInterface            = 0x01,
  372.     kCSMemory_And_IO_Interface    = 0x02
  373. };
  374.  
  375. /*    ‘present’ field values*/
  376.  
  377.  
  378. enum {
  379.     kCSOptionRegisterPresent    = 0x01,
  380.     kCSStatusRegisterPresent    = 0x02,
  381.     kCSPinReplacementRegisterPresent = 0x04,
  382.     kCSCopyRegisterPresent        = 0x08
  383. };
  384.  
  385. /*    ‘cardValues’ field values*/
  386.  
  387.  
  388. enum {
  389.     kCSOptionValueValid            = 0x01,
  390.     kCSStatusValueValid            = 0x02,
  391.     kCSPinReplacementValueValid    = 0x04,
  392.     kCSCopyValueValid            = 0x08
  393. };
  394.  
  395.  
  396. /*
  397.   ----------------        CSGetClientEventMask            ----------------
  398.   ----------------        CSSetClientEventMask            ----------------
  399. */
  400.  
  401.  
  402. struct GetSetClientEventMaskPB {
  403.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  404.     UInt16                             attributes;                    /* <-> bitmap of attributes*/
  405.     UInt16                             eventMask;                    /* <-> bitmap of events to be passed to client for this socket*/
  406.     UInt16                             socket;                        /*  -> logical socket number*/
  407. };
  408. typedef struct GetSetClientEventMaskPB    GetSetClientEventMaskPB;
  409. /*    ‘attributes’ field values*/
  410.  
  411. enum {
  412.     kCSEventMaskThisSocketOnly    = 0x0001
  413. };
  414.  
  415. /*    ‘eventMask’ field values*/
  416.  
  417.  
  418. enum {
  419.     kCSWriteProtectEvent        = 0x0001,
  420.     kCSCardLockChangeEvent        = 0x0002,
  421.     kCSEjectRequestEvent        = 0x0004,
  422.     kCSInsertRequestEvent        = 0x0008,
  423.     kCSBatteryDeadEvent            = 0x0010,
  424.     kCSBatteryLowEvent            = 0x0020,
  425.     kCSReadyChangeEvent            = 0x0040,
  426.     kCSCardDetectChangeEvent    = 0x0080,
  427.     kCSPMChangeEvent            = 0x0100,
  428.     kCSResetEvent                = 0x0200,
  429.     kCSSSUpdateEvent            = 0x0400,
  430.     kCSFunctionInterrupt        = 0x0800,
  431.     kCSAllEvents                = 0xFFFF
  432. };
  433.  
  434.  
  435. /*
  436.   ----------------        CSGetFirstClient                ----------------
  437.   ----------------        CSGetNextClient                    ----------------
  438. */
  439.  
  440.  
  441. struct GetClientPB {
  442.     UInt32                             clientHandle;                /* <-  clientHandle for this client*/
  443.     UInt16                             socket;                        /*  -> logical socket number*/
  444.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  445. };
  446. typedef struct GetClientPB                GetClientPB;
  447. /*    ‘attributes’ field values*/
  448.  
  449. enum {
  450.     kCSClientsForAllSockets        = 0x0000,
  451.     kCSClientsThisSocketOnly    = 0x0001
  452. };
  453.  
  454.  
  455. /*
  456.   ----------------        CSGetFirstTuple                    ----------------
  457.   ----------------        CSGetNextTuple                    ----------------
  458.   ----------------        CSGetTupleData                    ----------------
  459. */
  460.  
  461.  
  462. struct GetTuplePB {
  463.     UInt16                             socket;                        /*  -> logical socket number*/
  464.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  465.     UInt8                             desiredTuple;                /*  -> desired tuple code value, or $FF for all*/
  466.     UInt8                             tupleOffset;                /*  -> offset into tuple from link byte*/
  467.     UInt16                             flags;                        /* <-> internal use*/
  468.     UInt32                             linkOffset;                    /* <-> internal use*/
  469.     UInt32                             cisOffset;                    /* <-> internal use*/
  470.  
  471.     union {
  472.         struct {
  473.             UInt8                             tupleCode;            /* <-  tuple code found*/
  474.             UInt8                             tupleLink;            /* <-  link value for tuple found*/
  475.         }                                 TuplePB;
  476.  
  477.         struct {
  478.             UInt16                             tupleDataMax;        /*  -> maximum size of tuple data area*/
  479.             UInt16                             tupleDataLen;        /* <-  number of bytes in tuple body*/
  480.             TupleBody                         tupleData;            /* <-  tuple data*/
  481.         }                                 TupleDataPB;
  482.     }                                 u;
  483. };
  484. typedef struct GetTuplePB                GetTuplePB;
  485. /*    ‘attributes’ field values*/
  486.  
  487. enum {
  488.     kCSReturnLinkTuples            = 0x0001
  489. };
  490.  
  491.  
  492. /*
  493.   ----------------        CSRequestSocketMask                ----------------
  494.   ----------------        CSReleaseSocketMask                ----------------
  495. */
  496.  
  497.  
  498. struct ReqRelSocketMaskPB {
  499.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  500.     UInt16                             socket;                        /*  -> logical socket*/
  501.     UInt16                             eventMask;                    /*  -> bitmap of events to be passed to client for this socket*/
  502. };
  503. typedef struct ReqRelSocketMaskPB        ReqRelSocketMaskPB;
  504. /*    ‘eventMask’ field values (see above for Get/SetClientEventMask*/
  505.  
  506. /*----------------        CSGetStatus                        ----------------*/
  507.  
  508.  
  509. struct GetStatusPB {
  510.     UInt16                             socket;                        /*  -> logical socket number*/
  511.     UInt16                             cardState;                    /* <-  current state of installed card*/
  512.     UInt16                             socketState;                /* <-  current state of the socket*/
  513. };
  514. typedef struct GetStatusPB                GetStatusPB;
  515. /*    ‘cardState’ field values*/
  516.  
  517. enum {
  518.     kCSWriteProtected            = 0x0001,
  519.     kCSCardLocked                = 0x0002,
  520.     kCSEjectRequest                = 0x0004,
  521.     kCSInsertRequest            = 0x0008,
  522.     kCSBatteryDead                = 0x0010,
  523.     kCSBatteryLow                = 0x0020,
  524.     kCSReady                    = 0x0040,
  525.     kCSCardDetected                = 0x0080
  526. };
  527.  
  528. /*    ‘socketState’ field values*/
  529.  
  530.  
  531. enum {
  532.     kCSWriteProtectChanged        = 0x0001,
  533.     kCSCardLockChanged            = 0x0002,
  534.     kCSEjectRequestPending        = 0x0004,
  535.     kCSInsertRequestPending        = 0x0008,
  536.     kCSBatteryDeadChanged        = 0x0010,
  537.     kCSBatteryLowChanged        = 0x0020,
  538.     kCSReadyChanged                = 0x0040,
  539.     kCSCardDetectChanged        = 0x0080
  540. };
  541.  
  542.  
  543. /*
  544.   ----------------        CSModifyWindow                    ----------------
  545.   ----------------        CSReleaseWindow                    ----------------
  546.   ----------------        CSRequestWindow                    ----------------
  547. */
  548.  
  549.  
  550. struct ReqModRelWindowPB {
  551.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  552.     UInt32                             windowHandle;                /* <-> window descriptor*/
  553.     UInt16                             socket;                        /*  -> logical socket number*/
  554.     UInt16                             attributes;                    /*  -> window attributes (bitmap)*/
  555.     UInt32                             base;                        /* <-> system base address*/
  556.     UInt32                             size;                        /* <-> memory window size*/
  557.     UInt8                             accessSpeed;                /*  -> window access speed (bitmap)*/
  558.                                                                 /*        (not applicable for I/O mode)*/
  559.     UInt8                             padding[1];                    /* */
  560. };
  561. typedef struct ReqModRelWindowPB        ReqModRelWindowPB;
  562. /*    ‘attributes’ field values*/
  563.  
  564. enum {
  565.     kCSMemoryWindow                = 0x0001,
  566.     kCSIOWindow                    = 0x0002,
  567.     kCSAttributeWindow            = 0x0004,                        /* not normally used by Card Services clients*/
  568.     kCSWindowTypeMask            = 0x0007,
  569.     kCSEnableWindow                = 0x0008,
  570.     kCSAccessSpeedValid            = 0x0010,
  571.     kCSLittleEndian                = 0x0020,                        /* configure socket for little endianess*/
  572.     kCS16BitDataPath            = 0x0040,
  573.     kCSWindowPaged                = 0x0080,                        /* */
  574.     kCSWindowShared                = 0x0100,
  575.     kCSWindowFirstShared        = 0x0200,                        /* */
  576.     kCSWindowProgrammable        = 0x0400                        /* */
  577. };
  578.  
  579. /*    ‘accessSpeed’ field values*/
  580.  
  581.  
  582. enum {
  583.     kCSDeviceSpeedCodeMask        = 0x07,
  584.     kCSSpeedExponentMask        = 0x07,
  585.     kCSSpeedMantissaMask        = 0x78,
  586.     kCSUseWait                    = 0x80,
  587.     kCSAccessSpeed250nsec        = 0x01,
  588.     kCSAccessSpeed200nsec        = 0x02,
  589.     kCSAccessSpeed150nsec        = 0x03,
  590.     kCSAccessSpeed100nsec        = 0x04,
  591.     kCSExtAccSpeedMant1pt0        = 0x01,
  592.     kCSExtAccSpeedMant1pt2        = 0x02,
  593.     kCSExtAccSpeedMant1pt3        = 0x03,
  594.     kCSExtAccSpeedMant1pt5        = 0x04,
  595.     kCSExtAccSpeedMant2pt0        = 0x05,
  596.     kCSExtAccSpeedMant2pt5        = 0x06,
  597.     kCSExtAccSpeedMant3pt0        = 0x07,
  598.     kCSExtAccSpeedMant3pt5        = 0x08,
  599.     kCSExtAccSpeedMant4pt0        = 0x09,
  600.     kCSExtAccSpeedMant4pt5        = 0x0A,
  601.     kCSExtAccSpeedMant5pt0        = 0x0B,
  602.     kCSExtAccSpeedMant5pt5        = 0x0C,
  603.     kCSExtAccSpeedMant6pt0        = 0x0D,
  604.     kCSExtAccSpeedMant7pt0        = 0x0E,
  605.     kCSExtAccSpeedMant8pt0        = 0x0F,
  606.     kCSExtAccSpeedExp1ns        = 0x00,
  607.     kCSExtAccSpeedExp10ns        = 0x01,
  608.     kCSExtAccSpeedExp100ns        = 0x02,
  609.     kCSExtAccSpeedExp1us        = 0x03,
  610.     kCSExtAccSpeedExp10us        = 0x04,
  611.     kCSExtAccSpeedExp100us        = 0x05,
  612.     kCSExtAccSpeedExp1ms        = 0x06,
  613.     kCSExtAccSpeedExp10ms        = 0x07
  614. };
  615.  
  616.  
  617. /*
  618.   ----------------        CSRegisterClient                ----------------
  619.   ----------------        CSDeregisterClient                ----------------
  620. */
  621.  
  622.  
  623. struct ClientCallbackPB {
  624.     UInt16                             message;                    /*  -> which event this is*/
  625.     UInt16                             socket;                        /*  -> logical socket number*/
  626.     UInt16                             info;                        /*  -> function-specific*/
  627.     UInt16                             misc;                        /*  -> function-specific*/
  628.     Ptr                             reserved;                    /*  -> pointer to MTD request block*/
  629.     Ptr                             buffer;                        /*  -> function-specific*/
  630.     Ptr                             clientData;                    /*  -> pointer to client's data (from RegisterClient)*/
  631. };
  632. typedef struct ClientCallbackPB            ClientCallbackPB;
  633. typedef ClientCallbackPB *                ClientCallbackPBPtr;
  634. typedef CALLBACK_API( UInt16 , PCCardCSClientProcPtr )(ClientCallbackPBPtr ccPBPtr);
  635. typedef STACK_UPP_TYPE(PCCardCSClientProcPtr)                     PCCardCSClientUPP;
  636. enum { uppPCCardCSClientProcInfo = 0x000000E0 };                 /* pascal 2_bytes Func(4_bytes) */
  637. #define NewPCCardCSClientProc(userRoutine)                         (PCCardCSClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPCCardCSClientProcInfo, GetCurrentArchitecture())
  638. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)             CALL_ONE_PARAMETER_UPP((userRoutine), uppPCCardCSClientProcInfo, (ccPBPtr))
  639.  
  640. struct RegisterClientPB {
  641.     UInt32                             clientHandle;                /* <-  client descriptor*/
  642.     PCCardCSClientUPP                 clientEntry;                /*  -> universal procPtr to client's event handler*/
  643.     UInt16                             attributes;                    /*  -> bitmap of client attributes*/
  644.     UInt16                             eventMask;                    /*  -> bitmap of events to notify client*/
  645.     Ptr                             clientData;                    /*  -> pointer to client's data*/
  646.     UInt16                             version;                    /*  -> Card Services version this client expects*/
  647. };
  648. typedef struct RegisterClientPB            RegisterClientPB;
  649. /*    ‘attributes’ field values (see GetClientInfo)*/
  650. /*
  651.       kCSMemoryClient                    = 0x0001,
  652.       kCSIOClient                        = 0x0004,
  653.       kCSShareableCardInsertEvents    = 0x0008,
  654.       kCSExclusiveCardInsertEvents    = 0x0010
  655. */
  656.  
  657.  
  658. /*----------------        CSReleaseConfiguration            ----------------*/
  659.  
  660.  
  661. struct ReleaseConfigurationPB {
  662.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  663.     UInt16                             socket;                        /*  -> */
  664. };
  665. typedef struct ReleaseConfigurationPB    ReleaseConfigurationPB;
  666. /*----------------        CSResetCard                        ----------------*/
  667.  
  668.  
  669. struct ResetCardPB {
  670.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  671.     UInt16                             socket;                        /*  -> */
  672.     UInt16                             attributes;                    /*  -> xxx*/
  673. };
  674. typedef struct ResetCardPB                ResetCardPB;
  675. /*----------------        CSValidateCIS                    ----------------*/
  676.  
  677.  
  678. struct ValidateCISPB {
  679.     UInt16                             socket;                        /*  -> */
  680.     UInt16                             chains;                        /*  -> whether link/null tuples should be included*/
  681. };
  682. typedef struct ValidateCISPB            ValidateCISPB;
  683. /*
  684.   ----------------        CSRequestIO                        ----------------
  685.   ----------------        CSReleaseIO                        ----------------
  686. */
  687.  
  688.  
  689. struct ReqRelIOPB {
  690.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  691.     UInt16                             socket;                        /*  -> socket number*/
  692.     UInt16                             reserved;
  693.     UInt16                             basePort1;                    /*    ->    base I/O port for range*/
  694.     UInt8                             numPorts1;                    /*    ->    number of ports (e.g., bytes).*/
  695.     UInt8                             attributes1;                /*    ->    attributes*/
  696.  
  697.     UInt16                             basePort2;                    /*    ->    base I/O port for range*/
  698.     UInt8                             numPorts2;                    /*    ->    number of ports*/
  699.     UInt8                             attributes2;                /*    ->    attributes*/
  700.  
  701.     UInt8                             ioAddrLines;                /*    -> number of I/O lines decoded by card*/
  702.     UInt8                             reserved1;
  703. };
  704. typedef struct ReqRelIOPB                ReqRelIOPB;
  705. /*----------------        CSVendorSpecific                ----------------*/
  706.  
  707. struct VendorSpecificPB {
  708.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  709.     UInt16                             vsCode;
  710.     UInt16                             socket;
  711.     UInt32                             dataLen;                    /*  -> length of buffer pointed to by vsDataPtr*/
  712.     UInt8 *                            vsDataPtr;                    /*  -> Card Services version this client expects*/
  713. };
  714. typedef struct VendorSpecificPB            VendorSpecificPB;
  715. /*    ‘vsCode’ field values*/
  716.  
  717.  
  718. enum {
  719.     vsAppleReserved                = 0x0000,
  720.     vsEjectCard                    = 0x0001,
  721.     vsGetCardInfo                = 0x0002,
  722.     vsEnableSocketEvents        = 0x0003,
  723.     vsGetCardLocationIcon        = 0x0004,
  724.     vsGetCardLocationText        = 0x0005,
  725.     vsGetAdapterInfo            = 0x0006
  726. };
  727.  
  728. /*
  729.   ///////////////////////////////////////////////////////////////////////////////////////
  730.       GetAdapterInfo parameter block (vendor-specific call #6)
  731. */
  732.  
  733.  
  734. struct GetAdapterInfoPB {
  735.     UInt32                             attributes;                    /* <-  capabilties of socket's adapter*/
  736.     UInt16                             revision;                    /* <-  id of adapter*/
  737.     UInt16                             reserved;                    /* */
  738.     UInt16                             numVoltEntries;                /* <-  number of valid voltage values*/
  739.     UInt8 *                            voltages;                    /* <-> array of BCD voltage values*/
  740. };
  741. typedef struct GetAdapterInfoPB            GetAdapterInfoPB;
  742. /*    ‘attributes’ field values*/
  743.  
  744. enum {
  745.     kCSLevelModeInterrupts        = 0x00000001,
  746.     kCSPulseModeInterrupts        = 0x00000002,
  747.     kCSProgrammableWindowAddr    = 0x00000004,
  748.     kCSProgrammableWindowSize    = 0x00000008,
  749.     kCSSocketSleepPower            = 0x00000010,
  750.     kCSSoftwareEject            = 0x00000020,
  751.     kCSLockableSocket            = 0x00000040,
  752.     kCSInUseIndicator            = 0x00000080
  753. };
  754.  
  755. /*
  756.   ///////////////////////////////////////////////////////////////////////////////////////
  757.       GetCardInfo parameter block (vendor-specific call #2)
  758. */
  759.  
  760.  
  761. struct GetCardInfoPB {
  762.     UInt8                             cardType;                    /* <-  type of card in this socket (defined at top of file)*/
  763.     UInt8                             subType;                    /* <-  more detailed card type (defined at top of file)*/
  764.     UInt16                             reserved;                    /* <-> reserved (should be set to zero)*/
  765.     UInt16                             cardNameLen;                /*  -> maximum length of card name to be returned*/
  766.     UInt16                             vendorNameLen;                /*  -> maximum length of vendor name to be returned*/
  767.     UInt8 *                            cardName;                    /*  -> pointer to card name string (read from CIS), or nil*/
  768.     UInt8 *                            vendorName;                    /*  -> pointer to vendor name string (read from CIS), or nil*/
  769. };
  770. typedef struct GetCardInfoPB            GetCardInfoPB;
  771. /*    GetCardInfo card types*/
  772.  
  773. enum {
  774.     kCSUnknownCardType            = 0,
  775.     kCSMultiFunctionCardType    = 1,
  776.     kCSMemoryCardType            = 2,
  777.     kCSSerialPortCardType        = 3,
  778.     kCSSerialOnlyType            = 0,
  779.     kCSDataModemType            = 1,
  780.     kCSFaxModemType                = 2,
  781.     kCSFaxAndDataModemMask        = (kCSDataModemType | kCSFaxModemType),
  782.     kCSVoiceEncodingType        = 4,
  783.     kCSParallelPortCardType        = 4,
  784.     kCSFixedDiskCardType        = 5,
  785.     kCSUnknownFixedDiskType        = 0,
  786.     kCSATAInterface                = 1,
  787.     kCSRotatingDevice            = (0 << 7),
  788.     kCSSiliconDevice            = (1 << 7),
  789.     kCSVideoAdaptorCardType        = 6,
  790.     kCSNetworkAdaptorCardType    = 7,
  791.     kCSAIMSCardType                = 8,
  792.     kCSNumCardTypes                = 9
  793. };
  794.  
  795.  
  796. #ifndef __PCCARDENABLERPLUGIN__
  797. /*
  798.     NOTE: These prototypes conflict with PCCardEnablerPlugin.≈
  799.           You cannot use both PCCardEnablerPlugin.h and CardServices.h
  800.           
  801. */
  802. EXTERN_API( OSErr )
  803. CSVendorSpecific                (VendorSpecificPB *        pb)                                    TWOWORDINLINE(0x7000, 0xAAF0);
  804.  
  805. EXTERN_API( OSErr )
  806. CSRegisterClient                (RegisterClientPB *        pb)                                    TWOWORDINLINE(0x7001, 0xAAF0);
  807.  
  808. EXTERN_API( OSErr )
  809. CSDeregisterClient                (RegisterClientPB *        pb)                                    TWOWORDINLINE(0x7002, 0xAAF0);
  810.  
  811. EXTERN_API( OSErr )
  812. CSGetFirstTuple                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7003, 0xAAF0);
  813.  
  814. EXTERN_API( OSErr )
  815. CSGetNextTuple                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7004, 0xAAF0);
  816.  
  817. EXTERN_API( OSErr )
  818. CSGetTupleData                    (GetTuplePB *            pb)                                    TWOWORDINLINE(0x7005, 0xAAF0);
  819.  
  820. EXTERN_API( OSErr )
  821. CSGetConfigurationInfo            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x7006, 0xAAF0);
  822.  
  823. EXTERN_API( OSErr )
  824. CSGetCardServicesInfo            (GetCardServicesInfoPB * pb)                                TWOWORDINLINE(0x7007, 0xAAF0);
  825.  
  826. EXTERN_API( OSErr )
  827. CSGetStatus                        (GetStatusPB *            pb)                                    TWOWORDINLINE(0x7008, 0xAAF0);
  828.  
  829. EXTERN_API( OSErr )
  830. CSValidateCIS                    (ValidateCISPB *        pb)                                    TWOWORDINLINE(0x7009, 0xAAF0);
  831.  
  832. EXTERN_API( OSErr )
  833. CSGetFirstClient                (GetClientPB *            pb)                                    TWOWORDINLINE(0x700F, 0xAAF0);
  834.  
  835. EXTERN_API( OSErr )
  836. CSGetNextClient                    (GetClientPB *            pb)                                    TWOWORDINLINE(0x7010, 0xAAF0);
  837.  
  838. EXTERN_API( OSErr )
  839. CSGetClientInfo                    (GetClientInfoPB *        pb)                                    TWOWORDINLINE(0x7011, 0xAAF0);
  840.  
  841. EXTERN_API( OSErr )
  842. CSResetCard                        (ResetCardPB *            pb)                                    TWOWORDINLINE(0x7012, 0xAAF0);
  843.  
  844. EXTERN_API( OSErr )
  845. CSRequestWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7013, 0xAAF0);
  846.  
  847. EXTERN_API( OSErr )
  848. CSModifyWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7014, 0xAAF0);
  849.  
  850. EXTERN_API( OSErr )
  851. CSReleaseWindow                    (ReqModRelWindowPB *    pb)                                    TWOWORDINLINE(0x7015, 0xAAF0);
  852.  
  853. EXTERN_API( OSErr )
  854. CSRequestConfiguration            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701B, 0xAAF0);
  855.  
  856. EXTERN_API( OSErr )
  857. CSModifyConfiguration            (GetModRequestConfigInfoPB * pb)                            TWOWORDINLINE(0x701C, 0xAAF0);
  858.  
  859. EXTERN_API( OSErr )
  860. CSAccessConfigurationRegister    (AccessConfigurationRegisterPB * pb)                        TWOWORDINLINE(0x701D, 0xAAF0);
  861.  
  862. EXTERN_API( OSErr )
  863. CSReleaseConfiguration            (ReleaseConfigurationPB * pb)                                TWOWORDINLINE(0x701E, 0xAAF0);
  864.  
  865. EXTERN_API( OSErr )
  866. CSGetClientEventMask            (GetSetClientEventMaskPB * pb)                                TWOWORDINLINE(0x701F, 0xAAF0);
  867.  
  868. EXTERN_API( OSErr )
  869. CSSetClientEventMask            (GetSetClientEventMaskPB * pb)                                TWOWORDINLINE(0x7020, 0xAAF0);
  870.  
  871. EXTERN_API( OSErr )
  872. CSRequestSocketMask                (ReqRelSocketMaskPB *    pb)                                    TWOWORDINLINE(0x7021, 0xAAF0);
  873.  
  874. EXTERN_API( OSErr )
  875. CSReleaseSocketMask                (ReqRelSocketMaskPB *    pb)                                    TWOWORDINLINE(0x7022, 0xAAF0);
  876.  
  877.  
  878. /*
  879.       Additional calls which are required for all I/O clients when running on
  880.       systems which do not reserve dedicated I/O-spaces for each PC Card.
  881. */
  882.  
  883. EXTERN_API( OSErr )
  884. CSRequestIO                        (ReqRelIOPB *            pb)                                    TWOWORDINLINE(0x7025, 0xAAF0);
  885.  
  886. EXTERN_API( OSErr )
  887. CSReleaseIO                        (ReqRelIOPB *            pb)                                    TWOWORDINLINE(0x7026, 0xAAF0);
  888.  
  889. #endif  /* !defined(__PCCARDENABLERPLUGIN__) */
  890.  
  891.  
  892. #if PRAGMA_STRUCT_ALIGN
  893.     #pragma options align=reset
  894. #elif PRAGMA_STRUCT_PACKPUSH
  895.     #pragma pack(pop)
  896. #elif PRAGMA_STRUCT_PACK
  897.     #pragma pack()
  898. #endif
  899.  
  900. #ifdef PRAGMA_IMPORT_OFF
  901. #pragma import off
  902. #elif PRAGMA_IMPORT
  903. #pragma import reset
  904. #endif
  905.  
  906. #ifdef __cplusplus
  907. }
  908. #endif
  909.  
  910. #endif /* __CARDSERVICES__ */
  911.  
  912.